package com.lcc.pojo;

/**
 * /**
 *
 * @author 廖聪聪
 * @version 1.0
 * 创建时间 2020/7/24 15:43
 */

/**
 * 封装了购物车中的商品，包括对购物车的引用和商品数量
 */
public class ShoppingCartItem {
	private  Book book;
	private int quantity;

	public ShoppingCartItem(Book book) {
		this.book = book;
		this.quantity=1;
	}

	public Book getBook() {
		return book;
	}

	public void setBook(Book book) {
		this.book = book;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	/**
	 * 返回该商品在购物车中钱
	 * @return
	 */
	public double getItemMoney(){
		return book.getBook_price()*quantity;
	}

	/**
	 * 使其商品数量增加
	 */
	public void increment(){
		quantity++;
	}
}
